package Exercise;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class Exercise03 {
    public static void main(String[] args) {
        Cellphone cellphone = new Cellphone();
        cellphone.testwork(new computer() {
            @Override
            public double work(double n1, double n2) {
                return n1 + n2;
            }
        },10,8);

        cellphone.testwork(new computer() {
            @Override
            public double work(double n1, double n2) {
                return n1 * n2;
            }
        },10,8);
    }
}

interface computer{
 public double work(double n1,double n2);
}

class Cellphone{
    public void testwork(computer computer,double n1,double n2){
        double ret = computer.work(n1, n2);
        System.out.println("计算结果:" + ret);
    }
}
